<template>
  <view class="list">
    <view class="item" v-for="item in project_list" :key="item">
      <view class="head">
        <view class="left">Project id: {{ item.project_number }}</view>
        <view class="right"> {{ item.sum_total_price }}RMB </view>
      </view>
      <view class="body">
        <view class="item-title">
          <!--          <text>{{ item.created_at }}</text>-->
          <text>{{ item.submited_at_wx }}</text>
        </view>
        <view class="item-desc">{{ getLocalDesc(item) }}</view>
        <view class="item-btns">
          <view
            class="item-btn"
            @click="
              navigateTo(
                `/pages/subPackages/evaluate/index?id=${item.id}&client_id=${item.client_id}&project_number=${item.project_number}&project_name=${item.project_name}`
              )
            "
            >{{ $t('projectList.comment') }}</view
          >
          <view
            class="item-btn"
            @click="
              navigateTo(
                `/pages/subPackages/projectDetail/index?client_id=${item.client_id}&project_number=${item.project_number}&project_name=${item.project_name}&sum_total_price=${item.sum_total_price}&submited_at_wx=${item.submited_at_wx}`
              )
            "
            >{{ $t('projectList.details') }}</view
          >
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: 'ProjectList',
  props: {
    project_list: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    navigateTo(url) {
      uni.navigateTo({
        url: url
      })
    },
    getLocalDesc(project) {
      return this._i18n.locale === 'en' ? project.title_english : project.title
    }
  }
}
</script>
<style lang="scss" scoped>
@import '../../css/projectList.scss';
</style>
